﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CSharp;
using CSharp.Exam3;

namespace CSharp
{
    class Program
    {
        public static void ApproximateNumber()
        {
            double d1 = 1.000001;

            double d2 = 0.000001;
            /*
             * 0.2 0
             * 0.4 0
             * 0.8 0
             * 0.6 1
             * 0.2 1
             * 0.4 0
             * 0.8 0
             * 0.6 1
            */
            Console.WriteLine("d1 - d2 = {0}", (d1 - d2) - 1.0);


            decimal d3 = 1.000001M;

            decimal d4 = 0.000001M;

            Console.WriteLine("d1 - d2 = {0}", (d3 - d4) - 1.0M);
        }

        public static void DataTypes()
        {
            float f1 = 123.123456789f;
            double d1 = 123.12345678901234567890;
            decimal de1 = 1.1234567890123456789012345678901m;
            ushort us1 = 65535;

            Console.WriteLine("f1 = {0}", f1);
            Console.WriteLine("d1 = {0}", d1);
            Console.WriteLine("us1 = {0}", (short)us1);
            Console.WriteLine("de1 = {0}", de1);
        }

        public static void Operators()
        {
            int a = 5, b = 3;
            int c = a++ - --b;

            Console.WriteLine("a = {0}, b = {1}, c = {2}", a, b, c);

            int i = 1234567890;
            double d = 123.123457890;

            Console.WriteLine("i(N) = {0:N}, i(D) = {0:D}", i);
            Console.WriteLine("i(X) = {0:X}, i(x) = {0:x}", i);
            Console.WriteLine("d(G) = {0:G}, d(E) = {0:E}", d);

            string s1 = @"abc\t\ndef""";
            string s2 = "abc\tdef\nghi";

            Console.WriteLine("s1 = {0}", s1);
            Console.WriteLine("s2 = {0}", s2);
        }

        static void Main(string[] args)
        {
            //Student.Test();
            //Basic.TestDateTime();
            //DemoArray.Test1();
            //Inventory.SupplierTest.TestSupplierArray();
            //ApproximateNumber();
            //WheelChairTest.Test();

            //    int valOne = 5;
            //    int valTwo = 23;

            //    Calculation objCaculation = new Calculation(Addition);

            //    Console.WriteLine(valOne + " + " + valTwo + "=" + objCaculation(valOne, valTwo));

            int valOne = 5;
            int valTwo = 23;

            Mathematics m = new Mathematics();

            m.NumOne = 5;
            m.NumTwo = 23;

            m.Multiply += delegate()
                                 {
                                     int multiply = m.NumOne * m.NumTwo;
                                     Console.WriteLine("Finish = {0}", multiply);
                                     return multiply;
                                 };

            m.Finish += delegate()
                            {
                                Console.WriteLine("Finish Addition method");
                            };
        }
    }
}
